#include"Vector.h"




void TestMyVector1()
{
	bai::vector<int> v1;
	bai::vector<int> v2(10, 5);

	int array[] = { 1,2,3,4,5 };
	bai::vector<int> v3(array, array + sizeof(array) / sizeof(array[0]));

	bai::vector<int> v4(v3);

	for (auto e : v2)
		cout << e << " ";
	cout << endl;

	for (size_t i = 0; i < v3.size(); i++)
		cout << v3[i] << " ";
	cout << endl;

	bai::vector<int>::iterator it = v4.begin();
	while (it != v4.end())
	{
		cout << *it << " ";
		++it;
	}
	cout << endl;
}


void TestMyVector2()
{
	int array[] = { 1,2,3,4,5 };
	bai::vector<int> v(array, array + sizeof(array) / sizeof(array[0]));
	cout << v.size() << endl;
	cout << v.capacity() << endl;

	for (auto e : v)
		cout << e << " ";
	cout << endl;

	v.push_back(6);
	v.push_back(7);
	v.push_back(8);

	for (auto e : v)
		cout << e << " ";
	cout << endl;

	v.insert(v.begin(), 0);

	for (auto e : v)
		cout << e << " ";
	cout << endl;

	v.earse(v.begin());

	for (auto e : v)
		cout << e << " ";
	cout << endl;

	v.clear();
	if (v.empty())
		cout << "v is empty" << endl;
}

void TestMyVector3()
{
	bai::vector<int> v;

	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);

	for (auto e : v)
		cout << e << " ";
	cout << endl;
	
	cout << v.front() << endl;
	cout << v.back() << endl;

	v.pop_back();
	v.pop_back();

	for (auto e : v)
		cout << e << " ";
	cout << endl;
	cout << v.front() << endl;
	cout << v.back() << endl;

}

int main()
{
	TestMyVector4();
	_CrtDumpMemoryLeaks();
	return 0;
}


